package cn.com.zero.api.auth.config;

import cn.com.zero.api.auth.config.properties.TokenProperties;
import cn.com.zero.api.auth.util.TokenUtil;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @author xiongxj
 * @version 1.0.0
 * @Description token令牌的配置类
 * @createTime 2023/3/17 14:45
 */
@Configuration
public class TokenConfig {

    @Bean
    @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    @ConditionalOnBean(value = TokenProperties.class)
    public TokenUtil tokenUtil(TokenProperties tokenProperties) {
        return new TokenUtil(tokenProperties);
    }
}
